package com.thornbird.vehiclerecycling.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Entity
@Table(
        name = "users",
        uniqueConstraints = {
                @UniqueConstraint(columnNames = {"source", "userId"})
        },
        indexes = {
                @Index(columnList = "userId"),
                @Index(columnList = "userName"),
                @Index(columnList = "loginName"),
                @Index(columnList = "email")
        }
)
public class User extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 3437415355331369780L;

    // 用户来源
    @Column(columnDefinition = "varchar(50)", nullable = false)
    private String source;

    // 用户ID
    @Column(columnDefinition = "varchar(50)", nullable = false)
    private String userId;

    // 用户名
    @Column(columnDefinition = "varchar(50)", nullable = false)
    private String userName;

    // 登录名
    @Column(columnDefinition = "varchar(50)", nullable = true)
    private String loginName;

    // 邮箱
    @Column(columnDefinition = "varchar(100)", nullable = true)
    private String email;

    // 头像链接
    @Column(columnDefinition = "varchar(200)", nullable = true)
    private String avatarUrl;

    // 主页链接
    @Column(columnDefinition = "varchar(200)", nullable = true)
    private String profileUrl;

    // 简介
    @Column(columnDefinition = "varchar(2000)", nullable = true)
    private String bio;

    // 最后登录时间
    @Column(columnDefinition = "timestamp(6)", nullable = false)
    private Date lastLoginTime;

    // 超级用户
    @Column(columnDefinition = "bool", nullable = false)
    private Boolean superUser;

    // 生效
    @Column(columnDefinition = "bool", nullable = false)
    private Boolean active;

    // 姓名
    @Column(columnDefinition = "varchar(50)", nullable = true)
    private String realName;

    // 公司名
    @Column(columnDefinition = "varchar(50)", nullable = true)
    private String companyName;

    // 备注
    @Column(columnDefinition = "varchar(255)", nullable = true)
    private String remark;

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getAvatarUrl() {
        return avatarUrl;
    }

    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }

    public String getProfileUrl() {
        return profileUrl;
    }

    public void setProfileUrl(String profileUrl) {
        this.profileUrl = profileUrl;
    }

    public String getBio() {
        return bio;
    }

    public void setBio(String bio) {
        this.bio = bio;
    }

    public Date getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(Date lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    public Boolean getSuperUser() {
        return superUser;
    }

    public void setSuperUser(Boolean superUser) {
        this.superUser = superUser;
    }

    public Boolean getActive() {
        return active;
    }

    public void setActive(Boolean active) {
        this.active = active;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

}
